self.onmessage = function (params) {
    console.log(params);
    let data=params.data;
  if (data.action === "readerThead") {

    let theadString = renderTableThead(data.columns);
        console.log(theadString);
    self.postMessage(theadString);
  }
};

function renderTableThead(columns) {
  console.log(columns);
  let tr = `<tr>`;
  for (let i = 0; i < columns.length; i++) {
    let th = `<th>
       <div class="table-head">${columns[i].title}</div>
      </th>`;
    tr += th;
  }
  tr += `</tr>`;

  let thead = `<thead>${tr}</thead>`;
  return tr;
}
function renderTableTbody(columns) {
  console.log(columns);
  let tr = `<tr>`;
  for (let i = 0; i < columns.length; i++) {
    let th = `<th>
       <div class="table-head">${columns[i].title}</div>
      </th>`;
    tr += th;
  }
  tr += `</tr>`;

  let thead = `<thead>${tr}</thead>`;
  return tr;
}
